<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/board.css" />
<title>회원 리스트</title>
</head>
<body>
<div id='boardFrm' align="center">
    <div style="text-align: right; font-size: 12px;">
    페이지 : ${page}/${totalPage}&nbsp;&nbsp;&nbsp;</div>
	<!-- 게시판 타이틀 -->
	<div class='board_title'>
		<span style="width: 20%;">이메일</span>
		<span style="width: 15%;">회원이름</span>
		<span style="width: 10%;">휴대전화</span>
		<span style="width: 10%;">생년월일</span>
		<span style="width: 5%;">성별</span>
		<span style="width: 10%;">닉네임</span>
		<span style="width: 15%;">가입일</span>
		<span style="width: 10%;">수정/삭제</span>
	</div>

	<c:if test="${cnt == 0}">
		<div>
			<span style="width: 95%;">등록된 회원이 없습니다.</span>
		</div>
	</c:if>
	
	<c:if test="${cnt > 0}">
	<c:forEach var="member" items="${members}">
	   <div class = "board_text">
	      <span style="width: 20%;">${member.email}</span>
		  <span style="width: 15%;">${member.user_name}</span>
		  <span style="width: 10%;">${member.mobile}</span>
		  <span style="width: 10%;">${member.birth}</span>
		  <c:if test="${member.gender == 1}">
		  <span style="width: 5%;"><c:out value="남자" /></span>
		  </c:if>
		  <c:if test="${member.gender == 2}">
		  <span style="width: 5%;"><c:out value="여자" /></span>
		  </c:if>
		  <span style="width: 10%;">${member.nick_name}&nbsp;&nbsp;</span>
		  <span style="width: 15%;"><fmt:formatDate value="${member.reg_date}" pattern="yyyy-MM-dd" />&nbsp;&nbsp;&nbsp;&nbsp;</span>
		  <span style="width: 10%;">
		  <a href="modify_member.do?email=${member.email}">수정</a>
		  <a href="delete_member.do?email=${member.email}">삭제</a>&nbsp;&nbsp;&nbsp;
		  </span>
	  </div>
	</c:forEach>
	</c:if>
</div>
	<!-- 페이지 링크 생성 부분 -->
	<div align="center" id = "paging">
	   <ul>
					<c:if test="${totCnt > 10}">
						<c:forEach begin="${startPage}" end="${endPage}"  var="cur">
							<c:if test="${page == cur}">
							<li class="curPage">${cur}</li>
							</c:if>
							<c:if test="${page != cur}">
							<li><a href="member_manage.do?page=${cur}&keyword=${keyword}&field=${field}">${cur}</a></li>
							</c:if>
						</c:forEach>
					</c:if>
					<c:if test="${totCnt <= 10}">
					<li class="curPage">1</li>
					</c:if>
				</ul>
	</div>
	
	<!-- 검색영역 -->
	<div id="search_bottom" align="center">
		<form name="frmSearch" method="post" action="member_manage.do">
			<select name="field">
				<option value="EMAIL" <c:if test='field == "EMAIL"'>selected="selected"</c:if>>이메일</option>
				<option value="MOBILE" <c:if test='field == "MOBILE"'>selected="selected"</c:if>>휴대전화</option>
			</select>
			<input name="keyword" style="width:200px" value="${keyword}"/>
			<button>검색</button>
		</form>
	</div>
</body>
</html>